package com.rowline.admin.module.study.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * ClassName:thread
 * Created by 245167
 * on 2017/11/9  09:53
 * description:
 */
public class ThreadTest {

        public static void main(String[] args) {
            ExecutorService fixedThreadPool = Executors.newFixedThreadPool(3);
            for (int i = 0; i < 10; i++) {
                final int index = i;
                fixedThreadPool.execute(new Runnable() {
                    public void run() {
                        try {
                            System.out.println(index);
                            java.lang.Thread.sleep(2000);
                            System.out.println("===========");
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
        }

}
